#include <font_manager.h>
#include <string.h>
static PFontOpr g_ptFontOpr = NULL;
static PFontOpr g_ptDefaultFontOpr = NULL;


void Fonts_Register(PFontOpr       pFontOpr)
{
	pFontOpr->ptNext = g_ptFontOpr;
	g_ptFontOpr = pFontOpr;
}

int Fonts_Select(char * aFontOprname , char * aFontFileName)
{
	PFontOpr pTmpFontOpr= g_ptFontOpr;
	while(pTmpFontOpr)
	{
		if(strcmp(pTmpFontOpr->name , aFontOprname) == 0)
			break;

		pTmpFontOpr = pTmpFontOpr->ptNext;
	}
	if(!pTmpFontOpr)
		return -1;
	
	g_ptDefaultFontOpr = pTmpFontOpr;
	return pTmpFontOpr->FontInit(aFontFileName);
}

void Fonts_Init(void)
{	
	/* 声明外部函数 */
	extern void Get_freetypeFont(void);
	Get_freetypeFont();
}

int Font_SetSize(int FontSize)
{
	return g_ptDefaultFontOpr->SetFontSize(FontSize);
}

int GetFontBitMap(unsigned int dwCode , PFontBitMap ptFontBitMap)
{
	return g_ptDefaultFontOpr->GetFontBitMap(dwCode , ptFontBitMap); 
}

int Gets_StringRegionCar(char * str, PRegionCartesian ptRegionCartesian)
{
	return 	g_ptDefaultFontOpr->GetStringRegionCar(str,ptRegionCartesian);
}

